//package com.edu.labmanager.controller;
//
//import com.edu.labmanager.entity.Item;
//import com.edu.labmanager.entity.ItemInspection;
//import com.edu.labmanager.entity.Laboratory;
//import com.edu.labmanager.entity.Term;
//import com.edu.labmanager.service.IItemInspectionService;
//import com.edu.labmanager.service.IItemService;
//import com.edu.labmanager.service.ILaboratoryService;
//import com.edu.labmanager.service.ITermService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
//@Controller
//@Slf4j
//@RequestMapping("/inspection")
//public class InspectionController {
//    @Autowired
//    private IItemInspectionService itemInspectionService;
//    @Autowired
//    private IItemService itemService;
//    @Autowired
//    private ILaboratoryService laboratoryService;
//    @Autowired
//    private ITermService termService;
//    @GetMapping("/")
//    public String listInspections(Model model,
//                                  @RequestParam(required = false) Integer status,
//                                  @RequestParam(required = false) Integer labId,
//                                  @RequestParam(required = false) Integer itemId){
//        List<ItemInspection> inspections = itemInspectionService.lambdaQuery()
//                .eq(status!=null, ItemInspection::getStatus, status)
//                .eq(labId!=null, ItemInspection::getLabId, labId)
//                .eq(itemId!=null, ItemInspection::getItemId, itemId)
//                .list();
//        model.addAttribute("inspections", inspections);
//        //物品信息
//        Map<Integer, String> itemmap = itemService.list().stream().collect(Collectors.toMap(Item::getItemId, Item::getItemName));
//        model.addAttribute("itemmap", itemmap);
//        //学期信息
//        Map<Integer, String> map = termService.list().stream().collect(Collectors.toMap(Term::getTermId, Term::getTermName));
//        model.addAttribute("termMap",map);
//
//        //实验室信息
//        List<Laboratory> lab = laboratoryService.list();
//        Map<Integer, String> mapLab =lab.stream().collect(Collectors.toMap(Laboratory::getLaboratoryId, Laboratory::getLaboratoryName));
//        model.addAttribute("labMap",mapLab);
//        return "item-inspection-list";
//    }
//
//}
